//简易版工厂模式
class Person {
    name:string,
    age:number,
    constructor(name:string, age:number) {
        this.name = name
        this.age = age
    }
    fn1() {
        console.log('fn1')
    }
    fn2() {
        console.log('fn2')
    }
}

//工厂模式
class PersonFactory {
    createPerson(name:string, age:number) {
        return new Person(name, age)
    }
}
const factory = new PersonFactory()
const p1 = factory.createPerson('张三', 18)
const p2 = factory.createPerson('李四', 20)
